<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>keyczar.keyczart</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="keyczar-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >Keyczar</th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="keyczar-module.html">Package&nbsp;keyczar</a> ::
        Module&nbsp;keyczart
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="keyczar.keyczart-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="keyczar.keyczart-module.html">Module keyczar.keyczart</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">#!/usr/bin/python2.4</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Copyright 2008 Google Inc.</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Licensed under the Apache License, Version 2.0 (the "License");</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># you may not use this file except in compliance with the License.</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># You may obtain a copy of the License at</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># </tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">#      http://www.apache.org/licenses/LICENSE-2.0</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># </tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># Unless required by applicable law or agreed to in writing, software</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># distributed under the License is distributed on an "AS IS" BASIS,</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># See the License for the specific language governing permissions and</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># limitations under the License.</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring">Keyczart(ool) is a utility for creating and managing Keyczar keysets.</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">@author: arkajit.dey@gmail.com (Arkajit Dey)</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-0" class="py-name" targets="Module keyczar.errors=keyczar.errors-module.html"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-0', 'errors', 'link-0');">errors</a></tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Package keyczar=keyczar-module.html,Module keyczar.keyczar=keyczar.keyczar-module.html"><a title="keyczar
keyczar.keyczar" class="py-name" href="#" onclick="return doclink('link-1', 'keyczar', 'link-1');">keyczar</a></tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Module keyczar.keydata=keyczar.keydata-module.html"><a title="keyczar.keydata" class="py-name" href="#" onclick="return doclink('link-2', 'keydata', 'link-2');">keydata</a></tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-3" class="py-name" targets="Module keyczar.keyinfo=keyczar.keyinfo-module.html"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-3', 'keyinfo', 'link-3');">keyinfo</a></tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-4" class="py-name" targets="Module keyczar.readers=keyczar.readers-module.html"><a title="keyczar.readers" class="py-name" href="#" onclick="return doclink('link-4', 'readers', 'link-4');">readers</a></tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt id="link-5" class="py-name" targets="Module keyczar.util=keyczar.util-module.html"><a title="keyczar.util" class="py-name" href="#" onclick="return doclink('link-5', 'util', 'link-5');">util</a></tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt id="link-6" class="py-name" targets="Variable keyczar.keyczart.KEYSETS=keyczar.keyczart-module.html#KEYSETS"><a title="keyczar.keyczart.KEYSETS" class="py-name" href="#" onclick="return doclink('link-6', 'KEYSETS', 'link-6');">KEYSETS</a></tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">(</tt><tt class="py-string">'aes'</tt><tt class="py-op">,</tt> <tt id="link-7" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-7', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-8" class="py-name" targets="Variable keyczar.keyinfo.DECRYPT_AND_ENCRYPT=keyczar.keyinfo-module.html#DECRYPT_AND_ENCRYPT"><a title="keyczar.keyinfo.DECRYPT_AND_ENCRYPT" class="py-name" href="#" onclick="return doclink('link-8', 'DECRYPT_AND_ENCRYPT', 'link-8');">DECRYPT_AND_ENCRYPT</a></tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">           <tt class="py-op">(</tt><tt class="py-string">'aes-crypted'</tt><tt class="py-op">,</tt> <tt id="link-9" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-9', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-10" class="py-name"><a title="keyczar.keyinfo.DECRYPT_AND_ENCRYPT" class="py-name" href="#" onclick="return doclink('link-10', 'DECRYPT_AND_ENCRYPT', 'link-8');">DECRYPT_AND_ENCRYPT</a></tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-string">'aes'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">           <tt class="py-op">(</tt><tt class="py-string">'hmac'</tt><tt class="py-op">,</tt> <tt id="link-11" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-11', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-12" class="py-name" targets="Variable keyczar.keyinfo.SIGN_AND_VERIFY=keyczar.keyinfo-module.html#SIGN_AND_VERIFY"><a title="keyczar.keyinfo.SIGN_AND_VERIFY" class="py-name" href="#" onclick="return doclink('link-12', 'SIGN_AND_VERIFY', 'link-12');">SIGN_AND_VERIFY</a></tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">           <tt class="py-op">(</tt><tt class="py-string">'rsa'</tt><tt class="py-op">,</tt> <tt id="link-13" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-13', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="keyczar.keyinfo.DECRYPT_AND_ENCRYPT" class="py-name" href="#" onclick="return doclink('link-14', 'DECRYPT_AND_ENCRYPT', 'link-8');">DECRYPT_AND_ENCRYPT</a></tt><tt class="py-op">,</tt> <tt class="py-string">'rsa'</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">           <tt class="py-op">(</tt><tt class="py-string">'rsa-sign'</tt><tt class="py-op">,</tt> <tt id="link-15" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-15', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="keyczar.keyinfo.SIGN_AND_VERIFY" class="py-name" href="#" onclick="return doclink('link-16', 'SIGN_AND_VERIFY', 'link-12');">SIGN_AND_VERIFY</a></tt><tt class="py-op">,</tt> <tt class="py-string">'rsa'</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">           <tt class="py-op">(</tt><tt class="py-string">'dsa'</tt><tt class="py-op">,</tt> <tt id="link-17" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-17', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="keyczar.keyinfo.SIGN_AND_VERIFY" class="py-name" href="#" onclick="return doclink('link-18', 'SIGN_AND_VERIFY', 'link-12');">SIGN_AND_VERIFY</a></tt><tt class="py-op">,</tt> <tt class="py-string">'dsa'</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">]</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"> </tt>
<a name="_Name"></a><div id="_Name-def"><a name="L40"></a><tt class="py-lineno"> 40</tt> <a class="py-toggle" href="#" id="_Name-toggle" onclick="return toggle('_Name');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="keyczar.keyczart._Name-class.html">_Name</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_Name-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_Name-expanded"><a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">   </tt>
<a name="_Name.__init__"></a><div id="_Name.__init__-def"><a name="L42"></a><tt class="py-lineno"> 42</tt> <a class="py-toggle" href="#" id="_Name.__init__-toggle" onclick="return toggle('_Name.__init__');">-</a><tt class="py-line">  <tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart._Name-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">name</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_Name.__init__-collapsed" style="display:none;" pad="+++" indent="++++++"></div><div id="_Name.__init__-expanded"><a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line">    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">name</tt> <tt class="py-op">=</tt> <tt class="py-name">name</tt> </tt>
</div><a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">   </tt>
<a name="_Name.__str__"></a><div id="_Name.__str__-def"><a name="L45"></a><tt class="py-lineno"> 45</tt> <a class="py-toggle" href="#" id="_Name.__str__-toggle" onclick="return toggle('_Name.__str__');">-</a><tt class="py-line">  <tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart._Name-class.html#__str__">__str__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_Name.__str__-collapsed" style="display:none;" pad="+++" indent="++++++"></div><div id="_Name.__str__-expanded"><a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">name</tt> </tt>
</div></div><a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"> </tt>
<a name="Command"></a><div id="Command-def"><a name="L48"></a><tt class="py-lineno"> 48</tt> <a class="py-toggle" href="#" id="Command-toggle" onclick="return toggle('Command');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="keyczar.keyczart.Command-class.html">Command</a><tt class="py-op">(</tt><tt class="py-base-class">_Name</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Command-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Command-expanded"><a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">  <tt class="py-docstring">"""Enum representing keyczart commands."""</tt> </tt>
</div><a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"><tt id="link-19" class="py-name" targets="Variable keyczar.keyczart.CREATE=keyczar.keyczart-module.html#CREATE"><a title="keyczar.keyczart.CREATE" class="py-name" href="#" onclick="return doclink('link-19', 'CREATE', 'link-19');">CREATE</a></tt> <tt class="py-op">=</tt> <tt id="link-20" class="py-name" targets="Class keyczar.keyczart.Command=keyczar.keyczart.Command-class.html"><a title="keyczar.keyczart.Command" class="py-name" href="#" onclick="return doclink('link-20', 'Command', 'link-20');">Command</a></tt><tt class="py-op">(</tt><tt class="py-string">"create"</tt><tt class="py-op">)</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt id="link-21" class="py-name" targets="Variable keyczar.keyczart.ADDKEY=keyczar.keyczart-module.html#ADDKEY"><a title="keyczar.keyczart.ADDKEY" class="py-name" href="#" onclick="return doclink('link-21', 'ADDKEY', 'link-21');">ADDKEY</a></tt> <tt class="py-op">=</tt> <tt id="link-22" class="py-name"><a title="keyczar.keyczart.Command" class="py-name" href="#" onclick="return doclink('link-22', 'Command', 'link-20');">Command</a></tt><tt class="py-op">(</tt><tt class="py-string">"addkey"</tt><tt class="py-op">)</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line"><tt id="link-23" class="py-name" targets="Variable keyczar.keyczart.PUBKEY=keyczar.keyczart-module.html#PUBKEY"><a title="keyczar.keyczart.PUBKEY" class="py-name" href="#" onclick="return doclink('link-23', 'PUBKEY', 'link-23');">PUBKEY</a></tt> <tt class="py-op">=</tt> <tt id="link-24" class="py-name"><a title="keyczar.keyczart.Command" class="py-name" href="#" onclick="return doclink('link-24', 'Command', 'link-20');">Command</a></tt><tt class="py-op">(</tt><tt class="py-string">"pubkey"</tt><tt class="py-op">)</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"><tt id="link-25" class="py-name" targets="Variable keyczar.keyczart.PROMOTE=keyczar.keyczart-module.html#PROMOTE"><a title="keyczar.keyczart.PROMOTE" class="py-name" href="#" onclick="return doclink('link-25', 'PROMOTE', 'link-25');">PROMOTE</a></tt> <tt class="py-op">=</tt> <tt id="link-26" class="py-name"><a title="keyczar.keyczart.Command" class="py-name" href="#" onclick="return doclink('link-26', 'Command', 'link-20');">Command</a></tt><tt class="py-op">(</tt><tt class="py-string">"promote"</tt><tt class="py-op">)</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"><tt id="link-27" class="py-name" targets="Variable keyczar.keyczart.DEMOTE=keyczar.keyczart-module.html#DEMOTE"><a title="keyczar.keyczart.DEMOTE" class="py-name" href="#" onclick="return doclink('link-27', 'DEMOTE', 'link-27');">DEMOTE</a></tt> <tt class="py-op">=</tt> <tt id="link-28" class="py-name"><a title="keyczar.keyczart.Command" class="py-name" href="#" onclick="return doclink('link-28', 'Command', 'link-20');">Command</a></tt><tt class="py-op">(</tt><tt class="py-string">"demote"</tt><tt class="py-op">)</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line"><tt id="link-29" class="py-name" targets="Variable keyczar.keyczart.REVOKE=keyczar.keyczart-module.html#REVOKE"><a title="keyczar.keyczart.REVOKE" class="py-name" href="#" onclick="return doclink('link-29', 'REVOKE', 'link-29');">REVOKE</a></tt> <tt class="py-op">=</tt> <tt id="link-30" class="py-name"><a title="keyczar.keyczart.Command" class="py-name" href="#" onclick="return doclink('link-30', 'Command', 'link-20');">Command</a></tt><tt class="py-op">(</tt><tt class="py-string">"revoke"</tt><tt class="py-op">)</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"><tt id="link-31" class="py-name" targets="Variable keyczar.keyczart.GENKEY=keyczar.keyczart-module.html#GENKEY"><a title="keyczar.keyczart.GENKEY" class="py-name" href="#" onclick="return doclink('link-31', 'GENKEY', 'link-31');">GENKEY</a></tt> <tt class="py-op">=</tt> <tt id="link-32" class="py-name"><a title="keyczar.keyczart.Command" class="py-name" href="#" onclick="return doclink('link-32', 'Command', 'link-20');">Command</a></tt><tt class="py-op">(</tt><tt class="py-string">"genkey"</tt><tt class="py-op">)</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt id="link-33" class="py-name" targets="Variable keyczar.keyczart.commands=keyczar.keyczart-module.html#commands"><a title="keyczar.keyczart.commands" class="py-name" href="#" onclick="return doclink('link-33', 'commands', 'link-33');">commands</a></tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-string">"create"</tt><tt class="py-op">:</tt> <tt id="link-34" class="py-name"><a title="keyczar.keyczart.CREATE" class="py-name" href="#" onclick="return doclink('link-34', 'CREATE', 'link-19');">CREATE</a></tt><tt class="py-op">,</tt> <tt class="py-string">"addkey"</tt><tt class="py-op">:</tt> <tt id="link-35" class="py-name"><a title="keyczar.keyczart.ADDKEY" class="py-name" href="#" onclick="return doclink('link-35', 'ADDKEY', 'link-21');">ADDKEY</a></tt><tt class="py-op">,</tt> <tt class="py-string">"pubkey"</tt><tt class="py-op">:</tt> <tt id="link-36" class="py-name"><a title="keyczar.keyczart.PUBKEY" class="py-name" href="#" onclick="return doclink('link-36', 'PUBKEY', 'link-23');">PUBKEY</a></tt><tt class="py-op">,</tt>  </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">            <tt class="py-string">"promote"</tt><tt class="py-op">:</tt> <tt id="link-37" class="py-name"><a title="keyczar.keyczart.PROMOTE" class="py-name" href="#" onclick="return doclink('link-37', 'PROMOTE', 'link-25');">PROMOTE</a></tt><tt class="py-op">,</tt> <tt class="py-string">"demote"</tt><tt class="py-op">:</tt> <tt id="link-38" class="py-name"><a title="keyczar.keyczart.DEMOTE" class="py-name" href="#" onclick="return doclink('link-38', 'DEMOTE', 'link-27');">DEMOTE</a></tt><tt class="py-op">,</tt> <tt class="py-string">"revoke"</tt><tt class="py-op">:</tt> <tt id="link-39" class="py-name"><a title="keyczar.keyczart.REVOKE" class="py-name" href="#" onclick="return doclink('link-39', 'REVOKE', 'link-29');">REVOKE</a></tt><tt class="py-op">,</tt>  </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">            <tt class="py-string">"genkey"</tt><tt class="py-op">:</tt> <tt id="link-40" class="py-name"><a title="keyczar.keyczart.GENKEY" class="py-name" href="#" onclick="return doclink('link-40', 'GENKEY', 'link-31');">GENKEY</a></tt><tt class="py-op">}</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"> </tt>
<a name="GetCommand"></a><div id="GetCommand-def"><a name="L62"></a><tt class="py-lineno"> 62</tt> <a class="py-toggle" href="#" id="GetCommand-toggle" onclick="return toggle('GetCommand');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#GetCommand">GetCommand</a><tt class="py-op">(</tt><tt class="py-param">cmd</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="GetCommand-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="GetCommand-expanded"><a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">  <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt id="link-41" class="py-name"><a title="keyczar.keyczart.commands" class="py-name" href="#" onclick="return doclink('link-41', 'commands', 'link-33');">commands</a></tt><tt class="py-op">[</tt><tt class="py-name">cmd</tt><tt class="py-op">]</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">  <tt class="py-keyword">except</tt> <tt class="py-name">KeyError</tt><tt class="py-op">:</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">    <tt class="py-keyword">raise</tt> <tt id="link-42" class="py-name"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-42', 'errors', 'link-0');">errors</a></tt><tt class="py-op">.</tt><tt id="link-43" class="py-name" targets="Class keyczar.errors.KeyczarError=keyczar.errors.KeyczarError-class.html"><a title="keyczar.errors.KeyczarError" class="py-name" href="#" onclick="return doclink('link-43', 'KeyczarError', 'link-43');">KeyczarError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Illegal command"</tt><tt class="py-op">)</tt> </tt>
</div><a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"> </tt>
<a name="Flag"></a><div id="Flag-def"><a name="L68"></a><tt class="py-lineno"> 68</tt> <a class="py-toggle" href="#" id="Flag-toggle" onclick="return toggle('Flag');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="keyczar.keyczart.Flag-class.html">Flag</a><tt class="py-op">(</tt><tt class="py-base-class">_Name</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Flag-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Flag-expanded"><a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">  <tt class="py-docstring">"""Enum representing keyczart flags."""</tt> </tt>
</div><a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line"> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"><tt id="link-44" class="py-name" targets="Variable keyczar.keyczart.LOCATION=keyczar.keyczart-module.html#LOCATION"><a title="keyczar.keyczart.LOCATION" class="py-name" href="#" onclick="return doclink('link-44', 'LOCATION', 'link-44');">LOCATION</a></tt> <tt class="py-op">=</tt> <tt id="link-45" class="py-name" targets="Class keyczar.keyczart.Flag=keyczar.keyczart.Flag-class.html"><a title="keyczar.keyczart.Flag" class="py-name" href="#" onclick="return doclink('link-45', 'Flag', 'link-45');">Flag</a></tt><tt class="py-op">(</tt><tt class="py-string">"location"</tt><tt class="py-op">)</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt id="link-46" class="py-name" targets="Variable keyczar.keyczart.NAME=keyczar.keyczart-module.html#NAME"><a title="keyczar.keyczart.NAME" class="py-name" href="#" onclick="return doclink('link-46', 'NAME', 'link-46');">NAME</a></tt> <tt class="py-op">=</tt> <tt id="link-47" class="py-name"><a title="keyczar.keyczart.Flag" class="py-name" href="#" onclick="return doclink('link-47', 'Flag', 'link-45');">Flag</a></tt><tt class="py-op">(</tt><tt class="py-string">"name"</tt><tt class="py-op">)</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt id="link-48" class="py-name" targets="Variable keyczar.keyczart.SIZE=keyczar.keyczart-module.html#SIZE"><a title="keyczar.keyczart.SIZE" class="py-name" href="#" onclick="return doclink('link-48', 'SIZE', 'link-48');">SIZE</a></tt> <tt class="py-op">=</tt> <tt id="link-49" class="py-name"><a title="keyczar.keyczart.Flag" class="py-name" href="#" onclick="return doclink('link-49', 'Flag', 'link-45');">Flag</a></tt><tt class="py-op">(</tt><tt class="py-string">"size"</tt><tt class="py-op">)</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt id="link-50" class="py-name" targets="Variable keyczar.keyczart.STATUS=keyczar.keyczart-module.html#STATUS"><a title="keyczar.keyczart.STATUS" class="py-name" href="#" onclick="return doclink('link-50', 'STATUS', 'link-50');">STATUS</a></tt> <tt class="py-op">=</tt> <tt id="link-51" class="py-name"><a title="keyczar.keyczart.Flag" class="py-name" href="#" onclick="return doclink('link-51', 'Flag', 'link-45');">Flag</a></tt><tt class="py-op">(</tt><tt class="py-string">"status"</tt><tt class="py-op">)</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt id="link-52" class="py-name" targets="Variable keyczar.keyczart.PURPOSE=keyczar.keyczart-module.html#PURPOSE"><a title="keyczar.keyczart.PURPOSE" class="py-name" href="#" onclick="return doclink('link-52', 'PURPOSE', 'link-52');">PURPOSE</a></tt> <tt class="py-op">=</tt> <tt id="link-53" class="py-name"><a title="keyczar.keyczart.Flag" class="py-name" href="#" onclick="return doclink('link-53', 'Flag', 'link-45');">Flag</a></tt><tt class="py-op">(</tt><tt class="py-string">"purpose"</tt><tt class="py-op">)</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"><tt id="link-54" class="py-name" targets="Variable keyczar.keyczart.DESTINATION=keyczar.keyczart-module.html#DESTINATION"><a title="keyczar.keyczart.DESTINATION" class="py-name" href="#" onclick="return doclink('link-54', 'DESTINATION', 'link-54');">DESTINATION</a></tt> <tt class="py-op">=</tt> <tt id="link-55" class="py-name"><a title="keyczar.keyczart.Flag" class="py-name" href="#" onclick="return doclink('link-55', 'Flag', 'link-45');">Flag</a></tt><tt class="py-op">(</tt><tt class="py-string">"destination"</tt><tt class="py-op">)</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"><tt id="link-56" class="py-name" targets="Variable keyczar.keyczar.VERSION=keyczar.keyczar-module.html#VERSION,Variable keyczar.keyczart.VERSION=keyczar.keyczart-module.html#VERSION"><a title="keyczar.keyczar.VERSION
keyczar.keyczart.VERSION" class="py-name" href="#" onclick="return doclink('link-56', 'VERSION', 'link-56');">VERSION</a></tt> <tt class="py-op">=</tt> <tt id="link-57" class="py-name"><a title="keyczar.keyczart.Flag" class="py-name" href="#" onclick="return doclink('link-57', 'Flag', 'link-45');">Flag</a></tt><tt class="py-op">(</tt><tt class="py-string">"version"</tt><tt class="py-op">)</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"><tt id="link-58" class="py-name" targets="Variable keyczar.keyczart.ASYMMETRIC=keyczar.keyczart-module.html#ASYMMETRIC"><a title="keyczar.keyczart.ASYMMETRIC" class="py-name" href="#" onclick="return doclink('link-58', 'ASYMMETRIC', 'link-58');">ASYMMETRIC</a></tt> <tt class="py-op">=</tt> <tt id="link-59" class="py-name"><a title="keyczar.keyczart.Flag" class="py-name" href="#" onclick="return doclink('link-59', 'Flag', 'link-45');">Flag</a></tt><tt class="py-op">(</tt><tt class="py-string">"asymmetric"</tt><tt class="py-op">)</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line"><tt id="link-60" class="py-name" targets="Variable keyczar.keyczart.CRYPTER=keyczar.keyczart-module.html#CRYPTER"><a title="keyczar.keyczart.CRYPTER" class="py-name" href="#" onclick="return doclink('link-60', 'CRYPTER', 'link-60');">CRYPTER</a></tt> <tt class="py-op">=</tt> <tt id="link-61" class="py-name"><a title="keyczar.keyczart.Flag" class="py-name" href="#" onclick="return doclink('link-61', 'Flag', 'link-45');">Flag</a></tt><tt class="py-op">(</tt><tt class="py-string">"crypter"</tt><tt class="py-op">)</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"><tt id="link-62" class="py-name" targets="Variable keyczar.keyczart.flags=keyczar.keyczart-module.html#flags"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-62', 'flags', 'link-62');">flags</a></tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-string">"location"</tt><tt class="py-op">:</tt> <tt id="link-63" class="py-name"><a title="keyczar.keyczart.LOCATION" class="py-name" href="#" onclick="return doclink('link-63', 'LOCATION', 'link-44');">LOCATION</a></tt><tt class="py-op">,</tt> <tt class="py-string">"name"</tt><tt class="py-op">:</tt> <tt id="link-64" class="py-name"><a title="keyczar.keyczart.NAME" class="py-name" href="#" onclick="return doclink('link-64', 'NAME', 'link-46');">NAME</a></tt><tt class="py-op">,</tt> <tt class="py-string">"size"</tt><tt class="py-op">:</tt> <tt id="link-65" class="py-name"><a title="keyczar.keyczart.SIZE" class="py-name" href="#" onclick="return doclink('link-65', 'SIZE', 'link-48');">SIZE</a></tt><tt class="py-op">,</tt> <tt class="py-string">"status"</tt><tt class="py-op">:</tt> <tt id="link-66" class="py-name"><a title="keyczar.keyczart.STATUS" class="py-name" href="#" onclick="return doclink('link-66', 'STATUS', 'link-50');">STATUS</a></tt><tt class="py-op">,</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">         <tt class="py-string">"purpose"</tt><tt class="py-op">:</tt> <tt id="link-67" class="py-name"><a title="keyczar.keyczart.PURPOSE" class="py-name" href="#" onclick="return doclink('link-67', 'PURPOSE', 'link-52');">PURPOSE</a></tt><tt class="py-op">,</tt> <tt class="py-string">"destination"</tt><tt class="py-op">:</tt> <tt id="link-68" class="py-name"><a title="keyczar.keyczart.DESTINATION" class="py-name" href="#" onclick="return doclink('link-68', 'DESTINATION', 'link-54');">DESTINATION</a></tt><tt class="py-op">,</tt> <tt class="py-string">"version"</tt><tt class="py-op">:</tt> <tt id="link-69" class="py-name"><a title="keyczar.keyczar.VERSION
keyczar.keyczart.VERSION" class="py-name" href="#" onclick="return doclink('link-69', 'VERSION', 'link-56');">VERSION</a></tt><tt class="py-op">,</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">         <tt class="py-string">"asymmetric"</tt><tt class="py-op">:</tt> <tt id="link-70" class="py-name"><a title="keyczar.keyczart.ASYMMETRIC" class="py-name" href="#" onclick="return doclink('link-70', 'ASYMMETRIC', 'link-58');">ASYMMETRIC</a></tt><tt class="py-op">,</tt> <tt class="py-string">"crypter"</tt><tt class="py-op">:</tt> <tt id="link-71" class="py-name"><a title="keyczar.keyczart.CRYPTER" class="py-name" href="#" onclick="return doclink('link-71', 'CRYPTER', 'link-60');">CRYPTER</a></tt><tt class="py-op">}</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line"> </tt>
<a name="GetFlag"></a><div id="GetFlag-def"><a name="L84"></a><tt class="py-lineno"> 84</tt> <a class="py-toggle" href="#" id="GetFlag-toggle" onclick="return toggle('GetFlag');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#GetFlag">GetFlag</a><tt class="py-op">(</tt><tt class="py-param">flag</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="GetFlag-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="GetFlag-expanded"><a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">  <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt id="link-72" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-72', 'flags', 'link-62');">flags</a></tt><tt class="py-op">[</tt><tt class="py-name">flag</tt><tt class="py-op">]</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">  <tt class="py-keyword">except</tt> <tt class="py-name">KeyError</tt><tt class="py-op">:</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">    <tt class="py-keyword">raise</tt> <tt id="link-73" class="py-name"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-73', 'errors', 'link-0');">errors</a></tt><tt class="py-op">.</tt><tt id="link-74" class="py-name"><a title="keyczar.errors.KeyczarError" class="py-name" href="#" onclick="return doclink('link-74', 'KeyczarError', 'link-43');">KeyczarError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Unknown flag"</tt><tt class="py-op">)</tt> </tt>
</div><a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line"> </tt>
<a name="Create"></a><div id="Create-def"><a name="L90"></a><tt class="py-lineno"> 90</tt> <a class="py-toggle" href="#" id="Create-toggle" onclick="return toggle('Create');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#Create">Create</a><tt class="py-op">(</tt><tt class="py-param">loc</tt><tt class="py-op">,</tt> <tt class="py-param">name</tt><tt class="py-op">,</tt> <tt class="py-param">purpose</tt><tt class="py-op">,</tt> <tt class="py-param">asymmetric</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Create-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Create-expanded"><a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">loc</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">    <tt class="py-keyword">raise</tt> <tt id="link-75" class="py-name"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-75', 'errors', 'link-0');">errors</a></tt><tt class="py-op">.</tt><tt id="link-76" class="py-name"><a title="keyczar.errors.KeyczarError" class="py-name" href="#" onclick="return doclink('link-76', 'KeyczarError', 'link-43');">KeyczarError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Location missing"</tt><tt class="py-op">)</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">  <tt class="py-name">kmd</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">purpose</tt> <tt class="py-op">==</tt> <tt id="link-77" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-77', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-78" class="py-name"><a title="keyczar.keyinfo.SIGN_AND_VERIFY" class="py-name" href="#" onclick="return doclink('link-78', 'SIGN_AND_VERIFY', 'link-12');">SIGN_AND_VERIFY</a></tt><tt class="py-op">:</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">asymmetric</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">      <tt class="py-name">kmd</tt> <tt class="py-op">=</tt> <tt id="link-79" class="py-name"><a title="keyczar.keydata" class="py-name" href="#" onclick="return doclink('link-79', 'keydata', 'link-2');">keydata</a></tt><tt class="py-op">.</tt><tt id="link-80" class="py-name" targets="Class keyczar.keydata.KeyMetadata=keyczar.keydata.KeyMetadata-class.html"><a title="keyczar.keydata.KeyMetadata" class="py-name" href="#" onclick="return doclink('link-80', 'KeyMetadata', 'link-80');">KeyMetadata</a></tt><tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">,</tt> <tt class="py-name">purpose</tt><tt class="py-op">,</tt> <tt id="link-81" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-81', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-82" class="py-name" targets="Variable keyczar.keyinfo.HMAC_SHA1=keyczar.keyinfo-module.html#HMAC_SHA1"><a title="keyczar.keyinfo.HMAC_SHA1" class="py-name" href="#" onclick="return doclink('link-82', 'HMAC_SHA1', 'link-82');">HMAC_SHA1</a></tt><tt class="py-op">)</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">asymmetric</tt><tt class="py-op">.</tt><tt class="py-name">lower</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-string">"rsa"</tt><tt class="py-op">:</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">      <tt class="py-name">kmd</tt> <tt class="py-op">=</tt> <tt id="link-83" class="py-name"><a title="keyczar.keydata" class="py-name" href="#" onclick="return doclink('link-83', 'keydata', 'link-2');">keydata</a></tt><tt class="py-op">.</tt><tt id="link-84" class="py-name"><a title="keyczar.keydata.KeyMetadata" class="py-name" href="#" onclick="return doclink('link-84', 'KeyMetadata', 'link-80');">KeyMetadata</a></tt><tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">,</tt> <tt class="py-name">purpose</tt><tt class="py-op">,</tt> <tt id="link-85" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-85', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-86" class="py-name" targets="Variable keyczar.keyinfo.RSA_PRIV=keyczar.keyinfo-module.html#RSA_PRIV"><a title="keyczar.keyinfo.RSA_PRIV" class="py-name" href="#" onclick="return doclink('link-86', 'RSA_PRIV', 'link-86');">RSA_PRIV</a></tt><tt class="py-op">)</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt>  <tt class="py-comment"># default to DSA</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">      <tt class="py-name">kmd</tt> <tt class="py-op">=</tt> <tt id="link-87" class="py-name"><a title="keyczar.keydata" class="py-name" href="#" onclick="return doclink('link-87', 'keydata', 'link-2');">keydata</a></tt><tt class="py-op">.</tt><tt id="link-88" class="py-name"><a title="keyczar.keydata.KeyMetadata" class="py-name" href="#" onclick="return doclink('link-88', 'KeyMetadata', 'link-80');">KeyMetadata</a></tt><tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">,</tt> <tt class="py-name">purpose</tt><tt class="py-op">,</tt> <tt id="link-89" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-89', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-90" class="py-name" targets="Variable keyczar.keyinfo.DSA_PRIV=keyczar.keyinfo-module.html#DSA_PRIV"><a title="keyczar.keyinfo.DSA_PRIV" class="py-name" href="#" onclick="return doclink('link-90', 'DSA_PRIV', 'link-90');">DSA_PRIV</a></tt><tt class="py-op">)</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">  <tt class="py-keyword">elif</tt> <tt class="py-name">purpose</tt> <tt class="py-op">==</tt> <tt id="link-91" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-91', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-92" class="py-name"><a title="keyczar.keyinfo.DECRYPT_AND_ENCRYPT" class="py-name" href="#" onclick="return doclink('link-92', 'DECRYPT_AND_ENCRYPT', 'link-8');">DECRYPT_AND_ENCRYPT</a></tt><tt class="py-op">:</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">asymmetric</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">      <tt class="py-name">kmd</tt> <tt class="py-op">=</tt> <tt id="link-93" class="py-name"><a title="keyczar.keydata" class="py-name" href="#" onclick="return doclink('link-93', 'keydata', 'link-2');">keydata</a></tt><tt class="py-op">.</tt><tt id="link-94" class="py-name"><a title="keyczar.keydata.KeyMetadata" class="py-name" href="#" onclick="return doclink('link-94', 'KeyMetadata', 'link-80');">KeyMetadata</a></tt><tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">,</tt> <tt class="py-name">purpose</tt><tt class="py-op">,</tt> <tt id="link-95" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-95', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-96" class="py-name" targets="Variable keyczar.keyinfo.AES=keyczar.keyinfo-module.html#AES"><a title="keyczar.keyinfo.AES" class="py-name" href="#" onclick="return doclink('link-96', 'AES', 'link-96');">AES</a></tt><tt class="py-op">)</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt>  <tt class="py-comment"># default to RSA</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">      <tt class="py-name">kmd</tt> <tt class="py-op">=</tt> <tt id="link-97" class="py-name"><a title="keyczar.keydata" class="py-name" href="#" onclick="return doclink('link-97', 'keydata', 'link-2');">keydata</a></tt><tt class="py-op">.</tt><tt id="link-98" class="py-name"><a title="keyczar.keydata.KeyMetadata" class="py-name" href="#" onclick="return doclink('link-98', 'KeyMetadata', 'link-80');">KeyMetadata</a></tt><tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">,</tt> <tt class="py-name">purpose</tt><tt class="py-op">,</tt> <tt id="link-99" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-99', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-100" class="py-name"><a title="keyczar.keyinfo.RSA_PRIV" class="py-name" href="#" onclick="return doclink('link-100', 'RSA_PRIV', 'link-86');">RSA_PRIV</a></tt><tt class="py-op">)</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">  <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">    <tt class="py-keyword">raise</tt> <tt id="link-101" class="py-name"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-101', 'errors', 'link-0');">errors</a></tt><tt class="py-op">.</tt><tt id="link-102" class="py-name"><a title="keyczar.errors.KeyczarError" class="py-name" href="#" onclick="return doclink('link-102', 'KeyczarError', 'link-43');">KeyczarError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Missing or unsupported purpose"</tt><tt class="py-op">)</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">  <tt class="py-name">name</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">,</tt> <tt class="py-string">"meta"</tt><tt class="py-op">)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">exists</tt><tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">    <tt class="py-keyword">raise</tt> <tt id="link-103" class="py-name"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-103', 'errors', 'link-0');">errors</a></tt><tt class="py-op">.</tt><tt id="link-104" class="py-name"><a title="keyczar.errors.KeyczarError" class="py-name" href="#" onclick="return doclink('link-104', 'KeyczarError', 'link-43');">KeyczarError</a></tt><tt class="py-op">(</tt><tt class="py-string">"File already exists"</tt><tt class="py-op">)</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">  <tt id="link-105" class="py-name"><a title="keyczar.util" class="py-name" href="#" onclick="return doclink('link-105', 'util', 'link-5');">util</a></tt><tt class="py-op">.</tt><tt id="link-106" class="py-name" targets="Function keyczar.util.WriteFile()=keyczar.util-module.html#WriteFile"><a title="keyczar.util.WriteFile" class="py-name" href="#" onclick="return doclink('link-106', 'WriteFile', 'link-106');">WriteFile</a></tt><tt class="py-op">(</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">kmd</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">name</tt><tt class="py-op">)</tt> </tt>
</div><a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line"> </tt>
<a name="AddKey"></a><div id="AddKey-def"><a name="L113"></a><tt class="py-lineno">113</tt> <a class="py-toggle" href="#" id="AddKey-toggle" onclick="return toggle('AddKey');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#AddKey">AddKey</a><tt class="py-op">(</tt><tt class="py-param">loc</tt><tt class="py-op">,</tt> <tt class="py-param">status</tt><tt class="py-op">,</tt> <tt class="py-param">crypter</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">size</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="AddKey-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="AddKey-expanded"><a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">  <tt class="py-name">czar</tt> <tt class="py-op">=</tt> <tt id="link-107" class="py-name" targets="Function keyczar.keyczart.CreateGenericKeyczar()=keyczar.keyczart-module.html#CreateGenericKeyczar"><a title="keyczar.keyczart.CreateGenericKeyczar" class="py-name" href="#" onclick="return doclink('link-107', 'CreateGenericKeyczar', 'link-107');">CreateGenericKeyczar</a></tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt id="link-108" class="py-name" targets="Variable keyczar.keys.Key.size=keyczar.keys.Key-class.html#size"><a title="keyczar.keys.Key.size" class="py-name" href="#" onclick="return doclink('link-108', 'size', 'link-108');">size</a></tt> <tt class="py-op">==</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">    <tt id="link-109" class="py-name"><a title="keyczar.keys.Key.size" class="py-name" href="#" onclick="return doclink('link-109', 'size', 'link-108');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">  <tt class="py-name">czar</tt><tt class="py-op">.</tt><tt id="link-110" class="py-name" targets="Method keyczar.keyczar.GenericKeyczar.AddVersion()=keyczar.keyczar.GenericKeyczar-class.html#AddVersion,Method keyczar.keydata.KeyMetadata.AddVersion()=keyczar.keydata.KeyMetadata-class.html#AddVersion"><a title="keyczar.keyczar.GenericKeyczar.AddVersion
keyczar.keydata.KeyMetadata.AddVersion" class="py-name" href="#" onclick="return doclink('link-110', 'AddVersion', 'link-110');">AddVersion</a></tt><tt class="py-op">(</tt><tt id="link-111" class="py-name" targets="Variable keyczar.keydata.KeyVersion.status=keyczar.keydata.KeyVersion-class.html#status"><a title="keyczar.keydata.KeyVersion.status" class="py-name" href="#" onclick="return doclink('link-111', 'status', 'link-111');">status</a></tt><tt class="py-op">,</tt> <tt id="link-112" class="py-name"><a title="keyczar.keys.Key.size" class="py-name" href="#" onclick="return doclink('link-112', 'size', 'link-108');">size</a></tt><tt class="py-op">)</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">  <tt id="link-113" class="py-name" targets="Function keyczar.keyczart.UpdateGenericKeyczar()=keyczar.keyczart-module.html#UpdateGenericKeyczar"><a title="keyczar.keyczart.UpdateGenericKeyczar" class="py-name" href="#" onclick="return doclink('link-113', 'UpdateGenericKeyczar', 'link-113');">UpdateGenericKeyczar</a></tt><tt class="py-op">(</tt><tt class="py-name">czar</tt><tt class="py-op">,</tt> <tt class="py-name">loc</tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt> </tt>
</div><a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line"> </tt>
<a name="PubKey"></a><div id="PubKey-def"><a name="L120"></a><tt class="py-lineno">120</tt> <a class="py-toggle" href="#" id="PubKey-toggle" onclick="return toggle('PubKey');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#PubKey">PubKey</a><tt class="py-op">(</tt><tt class="py-param">loc</tt><tt class="py-op">,</tt> <tt class="py-param">dest</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="PubKey-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="PubKey-expanded"><a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">dest</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">    <tt class="py-keyword">raise</tt> <tt id="link-114" class="py-name"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-114', 'errors', 'link-0');">errors</a></tt><tt class="py-op">.</tt><tt id="link-115" class="py-name"><a title="keyczar.errors.KeyczarError" class="py-name" href="#" onclick="return doclink('link-115', 'KeyczarError', 'link-43');">KeyczarError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Must define destination"</tt><tt class="py-op">)</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">  <tt class="py-name">czar</tt> <tt class="py-op">=</tt> <tt id="link-116" class="py-name"><a title="keyczar.keyczart.CreateGenericKeyczar" class="py-name" href="#" onclick="return doclink('link-116', 'CreateGenericKeyczar', 'link-107');">CreateGenericKeyczar</a></tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">)</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">  <tt class="py-name">czar</tt><tt class="py-op">.</tt><tt id="link-117" class="py-name" targets="Method keyczar.keyczar.GenericKeyczar.PublicKeyExport()=keyczar.keyczar.GenericKeyczar-class.html#PublicKeyExport"><a title="keyczar.keyczar.GenericKeyczar.PublicKeyExport" class="py-name" href="#" onclick="return doclink('link-117', 'PublicKeyExport', 'link-117');">PublicKeyExport</a></tt><tt class="py-op">(</tt><tt class="py-name">dest</tt><tt class="py-op">)</tt> </tt>
</div><a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line"> </tt>
<a name="Promote"></a><div id="Promote-def"><a name="L126"></a><tt class="py-lineno">126</tt> <a class="py-toggle" href="#" id="Promote-toggle" onclick="return toggle('Promote');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#Promote">Promote</a><tt class="py-op">(</tt><tt class="py-param">loc</tt><tt class="py-op">,</tt> <tt class="py-param">num</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Promote-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Promote-expanded"><a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">  <tt class="py-name">czar</tt> <tt class="py-op">=</tt> <tt id="link-118" class="py-name"><a title="keyczar.keyczart.CreateGenericKeyczar" class="py-name" href="#" onclick="return doclink('link-118', 'CreateGenericKeyczar', 'link-107');">CreateGenericKeyczar</a></tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">)</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">num</tt> <tt class="py-op">&lt;</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">    <tt class="py-keyword">raise</tt> <tt id="link-119" class="py-name"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-119', 'errors', 'link-0');">errors</a></tt><tt class="py-op">.</tt><tt id="link-120" class="py-name"><a title="keyczar.errors.KeyczarError" class="py-name" href="#" onclick="return doclink('link-120', 'KeyczarError', 'link-43');">KeyczarError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Missing version"</tt><tt class="py-op">)</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">  <tt class="py-name">czar</tt><tt class="py-op">.</tt><tt id="link-121" class="py-name" targets="Method keyczar.keyczar.GenericKeyczar.Promote()=keyczar.keyczar.GenericKeyczar-class.html#Promote,Function keyczar.keyczart.Promote()=keyczar.keyczart-module.html#Promote"><a title="keyczar.keyczar.GenericKeyczar.Promote
keyczar.keyczart.Promote" class="py-name" href="#" onclick="return doclink('link-121', 'Promote', 'link-121');">Promote</a></tt><tt class="py-op">(</tt><tt class="py-name">num</tt><tt class="py-op">)</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">  <tt id="link-122" class="py-name"><a title="keyczar.keyczart.UpdateGenericKeyczar" class="py-name" href="#" onclick="return doclink('link-122', 'UpdateGenericKeyczar', 'link-113');">UpdateGenericKeyczar</a></tt><tt class="py-op">(</tt><tt class="py-name">czar</tt><tt class="py-op">,</tt> <tt class="py-name">loc</tt><tt class="py-op">)</tt> </tt>
</div><a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">   </tt>
<a name="Demote"></a><div id="Demote-def"><a name="L133"></a><tt class="py-lineno">133</tt> <a class="py-toggle" href="#" id="Demote-toggle" onclick="return toggle('Demote');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#Demote">Demote</a><tt class="py-op">(</tt><tt class="py-param">loc</tt><tt class="py-op">,</tt> <tt class="py-param">num</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Demote-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Demote-expanded"><a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">  <tt class="py-name">czar</tt> <tt class="py-op">=</tt> <tt id="link-123" class="py-name"><a title="keyczar.keyczart.CreateGenericKeyczar" class="py-name" href="#" onclick="return doclink('link-123', 'CreateGenericKeyczar', 'link-107');">CreateGenericKeyczar</a></tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">)</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">num</tt> <tt class="py-op">&lt;</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">    <tt class="py-keyword">raise</tt> <tt id="link-124" class="py-name"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-124', 'errors', 'link-0');">errors</a></tt><tt class="py-op">.</tt><tt id="link-125" class="py-name"><a title="keyczar.errors.KeyczarError" class="py-name" href="#" onclick="return doclink('link-125', 'KeyczarError', 'link-43');">KeyczarError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Missing version"</tt><tt class="py-op">)</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">  <tt class="py-name">czar</tt><tt class="py-op">.</tt><tt id="link-126" class="py-name" targets="Method keyczar.keyczar.GenericKeyczar.Demote()=keyczar.keyczar.GenericKeyczar-class.html#Demote,Function keyczar.keyczart.Demote()=keyczar.keyczart-module.html#Demote"><a title="keyczar.keyczar.GenericKeyczar.Demote
keyczar.keyczart.Demote" class="py-name" href="#" onclick="return doclink('link-126', 'Demote', 'link-126');">Demote</a></tt><tt class="py-op">(</tt><tt class="py-name">num</tt><tt class="py-op">)</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">  <tt id="link-127" class="py-name"><a title="keyczar.keyczart.UpdateGenericKeyczar" class="py-name" href="#" onclick="return doclink('link-127', 'UpdateGenericKeyczar', 'link-113');">UpdateGenericKeyczar</a></tt><tt class="py-op">(</tt><tt class="py-name">czar</tt><tt class="py-op">,</tt> <tt class="py-name">loc</tt><tt class="py-op">)</tt> </tt>
</div><a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line"> </tt>
<a name="Revoke"></a><div id="Revoke-def"><a name="L140"></a><tt class="py-lineno">140</tt> <a class="py-toggle" href="#" id="Revoke-toggle" onclick="return toggle('Revoke');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#Revoke">Revoke</a><tt class="py-op">(</tt><tt class="py-param">loc</tt><tt class="py-op">,</tt> <tt class="py-param">num</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Revoke-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Revoke-expanded"><a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line">  <tt class="py-name">czar</tt> <tt class="py-op">=</tt> <tt id="link-128" class="py-name"><a title="keyczar.keyczart.CreateGenericKeyczar" class="py-name" href="#" onclick="return doclink('link-128', 'CreateGenericKeyczar', 'link-107');">CreateGenericKeyczar</a></tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">)</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">num</tt> <tt class="py-op">&lt;</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">    <tt class="py-keyword">raise</tt> <tt id="link-129" class="py-name"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-129', 'errors', 'link-0');">errors</a></tt><tt class="py-op">.</tt><tt id="link-130" class="py-name"><a title="keyczar.errors.KeyczarError" class="py-name" href="#" onclick="return doclink('link-130', 'KeyczarError', 'link-43');">KeyczarError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Missing version"</tt><tt class="py-op">)</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">  <tt class="py-name">czar</tt><tt class="py-op">.</tt><tt id="link-131" class="py-name" targets="Method keyczar.keyczar.GenericKeyczar.Revoke()=keyczar.keyczar.GenericKeyczar-class.html#Revoke,Function keyczar.keyczart.Revoke()=keyczar.keyczart-module.html#Revoke"><a title="keyczar.keyczar.GenericKeyczar.Revoke
keyczar.keyczart.Revoke" class="py-name" href="#" onclick="return doclink('link-131', 'Revoke', 'link-131');">Revoke</a></tt><tt class="py-op">(</tt><tt class="py-name">num</tt><tt class="py-op">)</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line">  <tt id="link-132" class="py-name"><a title="keyczar.keyczart.UpdateGenericKeyczar" class="py-name" href="#" onclick="return doclink('link-132', 'UpdateGenericKeyczar', 'link-113');">UpdateGenericKeyczar</a></tt><tt class="py-op">(</tt><tt class="py-name">czar</tt><tt class="py-op">,</tt> <tt class="py-name">loc</tt><tt class="py-op">)</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line">  <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">remove</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">num</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt>  <tt class="py-comment"># remove key file</tt> </tt>
</div><a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line"> </tt>
<a name="GenKeySet"></a><div id="GenKeySet-def"><a name="L148"></a><tt class="py-lineno">148</tt> <a class="py-toggle" href="#" id="GenKeySet-toggle" onclick="return toggle('GenKeySet');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#GenKeySet">GenKeySet</a><tt class="py-op">(</tt><tt class="py-param">loc</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="GenKeySet-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="GenKeySet-expanded"><a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line">  <tt class="py-keyword">print</tt> <tt class="py-string">"Generating private key sets..."</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line">  <tt class="py-keyword">for</tt> <tt class="py-op">(</tt><tt class="py-name">name</tt><tt class="py-op">,</tt> <tt class="py-name">purpose</tt><tt class="py-op">,</tt> <tt class="py-name">asymmetric</tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt> <tt class="py-keyword">in</tt> <tt id="link-133" class="py-name"><a title="keyczar.keyczart.KEYSETS" class="py-name" href="#" onclick="return doclink('link-133', 'KEYSETS', 'link-6');">KEYSETS</a></tt><tt class="py-op">:</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">"."</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">    <tt class="py-name">dir</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">,</tt> <tt class="py-name">name</tt><tt class="py-op">)</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">crypter</tt><tt class="py-op">:</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">      <tt class="py-name">crypter</tt> <tt class="py-op">=</tt> <tt id="link-134" class="py-name"><a title="keyczar
keyczar.keyczar" class="py-name" href="#" onclick="return doclink('link-134', 'keyczar', 'link-1');">keyczar</a></tt><tt class="py-op">.</tt><tt id="link-135" class="py-name" targets="Class keyczar.keyczar.Crypter=keyczar.keyczar.Crypter-class.html"><a title="keyczar.keyczar.Crypter" class="py-name" href="#" onclick="return doclink('link-135', 'Crypter', 'link-135');">Crypter</a></tt><tt class="py-op">.</tt><tt id="link-136" class="py-name" targets="Static Method keyczar.keyczar.Crypter.Read()=keyczar.keyczar.Crypter-class.html#Read,Static Method keyczar.keyczar.Encrypter.Read()=keyczar.keyczar.Encrypter-class.html#Read,Static Method keyczar.keyczar.GenericKeyczar.Read()=keyczar.keyczar.GenericKeyczar-class.html#Read,Static Method keyczar.keyczar.Keyczar.Read()=keyczar.keyczar.Keyczar-class.html#Read,Static Method keyczar.keyczar.Signer.Read()=keyczar.keyczar.Signer-class.html#Read,Static Method keyczar.keyczar.Verifier.Read()=keyczar.keyczar.Verifier-class.html#Read,Static Method keyczar.keydata.KeyMetadata.Read()=keyczar.keydata.KeyMetadata-class.html#Read,Static Method keyczar.keydata.KeyVersion.Read()=keyczar.keydata.KeyVersion-class.html#Read,Static Method keyczar.keys.AesKey.Read()=keyczar.keys.AesKey-class.html#Read,Static Method keyczar.keys.DsaPrivateKey.Read()=keyczar.keys.DsaPrivateKey-class.html#Read,Static Method keyczar.keys.DsaPublicKey.Read()=keyczar.keys.DsaPublicKey-class.html#Read,Static Method keyczar.keys.HmacKey.Read()=keyczar.keys.HmacKey-class.html#Read,Static Method keyczar.keys.RsaPrivateKey.Read()=keyczar.keys.RsaPrivateKey-class.html#Read,Static Method keyczar.keys.RsaPublicKey.Read()=keyczar.keys.RsaPublicKey-class.html#Read"><a title="keyczar.keyczar.Crypter.Read
keyczar.keyczar.Encrypter.Read
keyczar.keyczar.GenericKeyczar.Read
keyczar.keyczar.Keyczar.Read
keyczar.keyczar.Signer.Read
keyczar.keyczar.Verifier.Read
keyczar.keydata.KeyMetadata.Read
keyczar.keydata.KeyVersion.Read
keyczar.keys.AesKey.Read
keyczar.keys.DsaPrivateKey.Read
keyczar.keys.DsaPublicKey.Read
keyczar.keys.HmacKey.Read
keyczar.keys.RsaPrivateKey.Read
keyczar.keys.RsaPublicKey.Read" class="py-name" href="#" onclick="return doclink('link-136', 'Read', 'link-136');">Read</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">    <tt id="link-137" class="py-name" targets="Function keyczar.keyczart.Clean()=keyczar.keyczart-module.html#Clean"><a title="keyczar.keyczart.Clean" class="py-name" href="#" onclick="return doclink('link-137', 'Clean', 'link-137');">Clean</a></tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">)</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">    <tt id="link-138" class="py-name" targets="Function keyczar.keyczart.Create()=keyczar.keyczart-module.html#Create"><a title="keyczar.keyczart.Create" class="py-name" href="#" onclick="return doclink('link-138', 'Create', 'link-138');">Create</a></tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt> <tt class="py-string">"Test"</tt><tt class="py-op">,</tt> <tt class="py-name">purpose</tt><tt class="py-op">,</tt> <tt class="py-name">asymmetric</tt><tt class="py-op">)</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">    <tt id="link-139" class="py-name" targets="Function keyczar.keyczart.AddKey()=keyczar.keyczart-module.html#AddKey"><a title="keyczar.keyczart.AddKey" class="py-name" href="#" onclick="return doclink('link-139', 'AddKey', 'link-139');">AddKey</a></tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt> <tt id="link-140" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-140', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-141" class="py-name" targets="Variable keyczar.keyinfo.PRIMARY=keyczar.keyinfo-module.html#PRIMARY"><a title="keyczar.keyinfo.PRIMARY" class="py-name" href="#" onclick="return doclink('link-141', 'PRIMARY', 'link-141');">PRIMARY</a></tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">    <tt id="link-142" class="py-name" targets="Function keyczar.keyczart.UseKey()=keyczar.keyczart-module.html#UseKey"><a title="keyczar.keyczart.UseKey" class="py-name" href="#" onclick="return doclink('link-142', 'UseKey', 'link-142');">UseKey</a></tt><tt class="py-op">(</tt><tt class="py-name">purpose</tt><tt class="py-op">,</tt> <tt class="py-name">dir</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt> <tt class="py-string">"1.out"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">    <tt id="link-143" class="py-name"><a title="keyczar.keyczart.AddKey" class="py-name" href="#" onclick="return doclink('link-143', 'AddKey', 'link-139');">AddKey</a></tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt> <tt id="link-144" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-144', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-145" class="py-name"><a title="keyczar.keyinfo.PRIMARY" class="py-name" href="#" onclick="return doclink('link-145', 'PRIMARY', 'link-141');">PRIMARY</a></tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">    <tt id="link-146" class="py-name"><a title="keyczar.keyczart.UseKey" class="py-name" href="#" onclick="return doclink('link-146', 'UseKey', 'link-142');">UseKey</a></tt><tt class="py-op">(</tt><tt class="py-name">purpose</tt><tt class="py-op">,</tt> <tt class="py-name">dir</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt> <tt class="py-string">"2.out"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line">   </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">  <tt class="py-keyword">print</tt> <tt class="py-string">"Exporting public key sets..."</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line">  <tt class="py-keyword">for</tt> <tt class="py-name">name</tt> <tt class="py-keyword">in</tt> <tt class="py-op">(</tt><tt class="py-string">'dsa'</tt><tt class="py-op">,</tt> <tt class="py-string">'rsa-sign'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">"."</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line">    <tt class="py-name">dir</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">,</tt> <tt class="py-name">name</tt><tt class="py-op">)</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line">    <tt class="py-name">dest</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">,</tt> <tt class="py-name">name</tt> <tt class="py-op">+</tt> <tt class="py-string">'.public'</tt><tt class="py-op">)</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line">    <tt id="link-147" class="py-name" targets="Function keyczar.keyczart.PubKey()=keyczar.keyczart-module.html#PubKey"><a title="keyczar.keyczart.PubKey" class="py-name" href="#" onclick="return doclink('link-147', 'PubKey', 'link-147');">PubKey</a></tt><tt class="py-op">(</tt><tt class="py-name">dir</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">)</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">  <tt class="py-keyword">print</tt> <tt class="py-string">"Done!"</tt> </tt>
</div><a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line"> </tt>
<a name="Clean"></a><div id="Clean-def"><a name="L170"></a><tt class="py-lineno">170</tt> <a class="py-toggle" href="#" id="Clean-toggle" onclick="return toggle('Clean');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#Clean">Clean</a><tt class="py-op">(</tt><tt class="py-param">directory</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Clean-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Clean-expanded"><a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">  <tt class="py-keyword">for</tt> <tt class="py-name">file</tt> <tt class="py-keyword">in</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">listdir</tt><tt class="py-op">(</tt><tt class="py-name">directory</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line">    <tt class="py-name">path</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">directory</tt><tt class="py-op">,</tt> <tt class="py-name">file</tt><tt class="py-op">)</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">isdir</tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">)</tt><tt class="py-op">:</tt>  </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line">      <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">remove</tt><tt class="py-op">(</tt><tt class="py-name">path</tt><tt class="py-op">)</tt> </tt>
</div><a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line"> </tt>
<a name="UseKey"></a><div id="UseKey-def"><a name="L176"></a><tt class="py-lineno">176</tt> <a class="py-toggle" href="#" id="UseKey-toggle" onclick="return toggle('UseKey');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#UseKey">UseKey</a><tt class="py-op">(</tt><tt class="py-param">purpose</tt><tt class="py-op">,</tt> <tt class="py-param">loc</tt><tt class="py-op">,</tt> <tt class="py-param">dest</tt><tt class="py-op">,</tt> <tt class="py-param">crypter</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">msg</tt><tt class="py-op">=</tt><tt class="py-string">"This is some test data"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="UseKey-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="UseKey-expanded"><a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">  <tt class="py-name">reader</tt> <tt class="py-op">=</tt> <tt id="link-148" class="py-name"><a title="keyczar.readers" class="py-name" href="#" onclick="return doclink('link-148', 'readers', 'link-4');">readers</a></tt><tt class="py-op">.</tt><tt id="link-149" class="py-name" targets="Class keyczar.readers.FileReader=keyczar.readers.FileReader-class.html"><a title="keyczar.readers.FileReader" class="py-name" href="#" onclick="return doclink('link-149', 'FileReader', 'link-149');">FileReader</a></tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">)</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">  <tt class="py-name">answer</tt> <tt class="py-op">=</tt> <tt class="py-string">""</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">crypter</tt><tt class="py-op">:</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line">    <tt class="py-name">reader</tt> <tt class="py-op">=</tt> <tt id="link-150" class="py-name"><a title="keyczar.readers" class="py-name" href="#" onclick="return doclink('link-150', 'readers', 'link-4');">readers</a></tt><tt class="py-op">.</tt><tt id="link-151" class="py-name" targets="Class keyczar.readers.EncryptedReader=keyczar.readers.EncryptedReader-class.html"><a title="keyczar.readers.EncryptedReader" class="py-name" href="#" onclick="return doclink('link-151', 'EncryptedReader', 'link-151');">EncryptedReader</a></tt><tt class="py-op">(</tt><tt class="py-name">reader</tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">purpose</tt> <tt class="py-op">==</tt> <tt id="link-152" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-152', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-153" class="py-name"><a title="keyczar.keyinfo.DECRYPT_AND_ENCRYPT" class="py-name" href="#" onclick="return doclink('link-153', 'DECRYPT_AND_ENCRYPT', 'link-8');">DECRYPT_AND_ENCRYPT</a></tt><tt class="py-op">:</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line">    <tt class="py-name">answer</tt> <tt class="py-op">=</tt> <tt id="link-154" class="py-name"><a title="keyczar
keyczar.keyczar" class="py-name" href="#" onclick="return doclink('link-154', 'keyczar', 'link-1');">keyczar</a></tt><tt class="py-op">.</tt><tt id="link-155" class="py-name"><a title="keyczar.keyczar.Crypter" class="py-name" href="#" onclick="return doclink('link-155', 'Crypter', 'link-135');">Crypter</a></tt><tt class="py-op">(</tt><tt class="py-name">reader</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-156" class="py-name" targets="Method keyczar.keyczar.Encrypter.Encrypt()=keyczar.keyczar.Encrypter-class.html#Encrypt,Method keyczar.keys.AesKey.Encrypt()=keyczar.keys.AesKey-class.html#Encrypt,Method keyczar.keys.RsaPrivateKey.Encrypt()=keyczar.keys.RsaPrivateKey-class.html#Encrypt,Method keyczar.keys.RsaPublicKey.Encrypt()=keyczar.keys.RsaPublicKey-class.html#Encrypt"><a title="keyczar.keyczar.Encrypter.Encrypt
keyczar.keys.AesKey.Encrypt
keyczar.keys.RsaPrivateKey.Encrypt
keyczar.keys.RsaPublicKey.Encrypt" class="py-name" href="#" onclick="return doclink('link-156', 'Encrypt', 'link-156');">Encrypt</a></tt><tt class="py-op">(</tt><tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line">  <tt class="py-keyword">elif</tt> <tt class="py-name">purpose</tt> <tt class="py-op">==</tt> <tt id="link-157" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-157', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-158" class="py-name"><a title="keyczar.keyinfo.SIGN_AND_VERIFY" class="py-name" href="#" onclick="return doclink('link-158', 'SIGN_AND_VERIFY', 'link-12');">SIGN_AND_VERIFY</a></tt><tt class="py-op">:</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line">    <tt class="py-name">answer</tt> <tt class="py-op">=</tt> <tt id="link-159" class="py-name"><a title="keyczar
keyczar.keyczar" class="py-name" href="#" onclick="return doclink('link-159', 'keyczar', 'link-1');">keyczar</a></tt><tt class="py-op">.</tt><tt id="link-160" class="py-name" targets="Class keyczar.keyczar.Signer=keyczar.keyczar.Signer-class.html"><a title="keyczar.keyczar.Signer" class="py-name" href="#" onclick="return doclink('link-160', 'Signer', 'link-160');">Signer</a></tt><tt class="py-op">(</tt><tt class="py-name">reader</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-161" class="py-name" targets="Method keyczar.keyczar.Signer.Sign()=keyczar.keyczar.Signer-class.html#Sign,Method keyczar.keys.DsaPrivateKey.Sign()=keyczar.keys.DsaPrivateKey-class.html#Sign,Method keyczar.keys.HmacKey.Sign()=keyczar.keys.HmacKey-class.html#Sign,Method keyczar.keys.RsaPrivateKey.Sign()=keyczar.keys.RsaPrivateKey-class.html#Sign"><a title="keyczar.keyczar.Signer.Sign
keyczar.keys.DsaPrivateKey.Sign
keyczar.keys.HmacKey.Sign
keyczar.keys.RsaPrivateKey.Sign" class="py-name" href="#" onclick="return doclink('link-161', 'Sign', 'link-161');">Sign</a></tt><tt class="py-op">(</tt><tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line">  <tt id="link-162" class="py-name"><a title="keyczar.util" class="py-name" href="#" onclick="return doclink('link-162', 'util', 'link-5');">util</a></tt><tt class="py-op">.</tt><tt id="link-163" class="py-name"><a title="keyczar.util.WriteFile" class="py-name" href="#" onclick="return doclink('link-163', 'WriteFile', 'link-106');">WriteFile</a></tt><tt class="py-op">(</tt><tt class="py-name">answer</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">)</tt> </tt>
</div><a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line"> </tt>
<a name="Usage"></a><div id="Usage-def"><a name="L187"></a><tt class="py-lineno">187</tt> <a class="py-toggle" href="#" id="Usage-toggle" onclick="return toggle('Usage');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#Usage">Usage</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Usage-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Usage-expanded"><a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">  <tt class="py-keyword">print</tt> <tt class="py-string">'''Usage: "Keyczart command flags"</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line"><tt class="py-string">  Commands: create addkey pubkey promote demote revoke</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line"><tt class="py-string">Flags: location name size status purpose destination version asymmetric crypter</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line"><tt class="py-string">Command Usage:</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line"><tt class="py-string">create --location=/path/to/keys --purpose=(crypt|sign) [--name="A name"] [--asymmetric=(dsa|rsa)]</tt> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line"><tt class="py-string">  Creates a new, empty key set in the given location.</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line"><tt class="py-string">  This key set must have a purpose of either "crypt" or "sign"</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line"><tt class="py-string">  and may optionally be given a name. The optional asymmetric </tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line"><tt class="py-string">  flag will generate a public key set of the given algorithm.</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line"><tt class="py-string">  The "dsa" asymmetric value is valid only for sets with "sign" purpose.</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line"><tt class="py-string">  with the given purpose.</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line"><tt class="py-string">addkey --location=/path/to/keys [--status=(active|primary)] [--size=size] [--crypter=crypterLocation]</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line"><tt class="py-string">  Adds a new key to an existing key set. Optionally</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line"><tt class="py-string">  specify a purpose, which is active by default. Optionally</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line"><tt class="py-string">  specify a key size in bits. Also optionally specify the</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line"><tt class="py-string">  location of a set of crypting keys, which will be used to</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line"><tt class="py-string">  encrypt this key set.</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line"><tt class="py-string">pubkey --location=/path/to/keys --destination=/destination</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line"><tt class="py-string">  Extracts public keys from a given key set and writes them</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line"><tt class="py-string">  to the destination. The "pubkey" command Only works for</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line"><tt class="py-string">  key sets that were created with the "--asymmetric" flag.</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line"><tt class="py-string">promote --location=/path/to/keys --version=versionNumber</tt> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line"><tt class="py-string">  Promotes the status of the given key version in the given </tt> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line"><tt class="py-string">  location. Active keys are promoted to primary (which demotes </tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line"><tt class="py-string">  any existing primary key to active). Keys scheduled for </tt> </tt>
<a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line"><tt class="py-string">  revocation are promoted to be active.</tt> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line"><tt class="py-string">demote --location=/path/to/keys --version=versionNumber</tt> </tt>
<a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line"><tt class="py-string">  Demotes the status of the given key version in the given</tt> </tt>
<a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line"><tt class="py-string">  location. Primary keys are demoted to active. Active keys</tt> </tt>
<a name="L217"></a><tt class="py-lineno">217</tt>  <tt class="py-line"><tt class="py-string">  are scheduled for revocation.</tt> </tt>
<a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line"><tt class="py-string">revoke --location=/path/to/keys --version=versionNumber</tt> </tt>
<a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line"><tt class="py-string">  Revokes the key of the given version number.</tt> </tt>
<a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line"><tt class="py-string">  This key must have been scheduled for revocation by the</tt> </tt>
<a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line"><tt class="py-string">  promote command. WARNING: The key will be destroyed.</tt> </tt>
<a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line"><tt class="py-string"></tt> </tt>
<a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line"><tt class="py-string">Optional flags are in [brackets]. The notation (a|b|c) means "a", "b", and "c"</tt> </tt>
<a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line"><tt class="py-string">are the valid choices'''</tt> </tt>
</div><a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line"> </tt>
<a name="CreateGenericKeyczar"></a><div id="CreateGenericKeyczar-def"><a name="L226"></a><tt class="py-lineno">226</tt> <a class="py-toggle" href="#" id="CreateGenericKeyczar-toggle" onclick="return toggle('CreateGenericKeyczar');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#CreateGenericKeyczar">CreateGenericKeyczar</a><tt class="py-op">(</tt><tt class="py-param">loc</tt><tt class="py-op">,</tt> <tt class="py-param">crypter</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CreateGenericKeyczar-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="CreateGenericKeyczar-expanded"><a name="L227"></a><tt class="py-lineno">227</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">loc</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L228"></a><tt class="py-lineno">228</tt>  <tt class="py-line">    <tt class="py-keyword">raise</tt> <tt id="link-164" class="py-name"><a title="keyczar.errors" class="py-name" href="#" onclick="return doclink('link-164', 'errors', 'link-0');">errors</a></tt><tt class="py-op">.</tt><tt id="link-165" class="py-name"><a title="keyczar.errors.KeyczarError" class="py-name" href="#" onclick="return doclink('link-165', 'KeyczarError', 'link-43');">KeyczarError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Need location"</tt><tt class="py-op">)</tt> </tt>
<a name="L229"></a><tt class="py-lineno">229</tt>  <tt class="py-line">  <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L230"></a><tt class="py-lineno">230</tt>  <tt class="py-line">    <tt class="py-name">reader</tt> <tt class="py-op">=</tt> <tt id="link-166" class="py-name"><a title="keyczar.readers" class="py-name" href="#" onclick="return doclink('link-166', 'readers', 'link-4');">readers</a></tt><tt class="py-op">.</tt><tt id="link-167" class="py-name"><a title="keyczar.readers.FileReader" class="py-name" href="#" onclick="return doclink('link-167', 'FileReader', 'link-149');">FileReader</a></tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">)</tt> </tt>
<a name="L231"></a><tt class="py-lineno">231</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">crypter</tt><tt class="py-op">:</tt> </tt>
<a name="L232"></a><tt class="py-lineno">232</tt>  <tt class="py-line">      <tt class="py-name">reader</tt> <tt class="py-op">=</tt> <tt id="link-168" class="py-name"><a title="keyczar.readers" class="py-name" href="#" onclick="return doclink('link-168', 'readers', 'link-4');">readers</a></tt><tt class="py-op">.</tt><tt id="link-169" class="py-name"><a title="keyczar.readers.EncryptedReader" class="py-name" href="#" onclick="return doclink('link-169', 'EncryptedReader', 'link-151');">EncryptedReader</a></tt><tt class="py-op">(</tt><tt class="py-name">reader</tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt> </tt>
<a name="L233"></a><tt class="py-lineno">233</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt id="link-170" class="py-name"><a title="keyczar
keyczar.keyczar" class="py-name" href="#" onclick="return doclink('link-170', 'keyczar', 'link-1');">keyczar</a></tt><tt class="py-op">.</tt><tt id="link-171" class="py-name" targets="Class keyczar.keyczar.GenericKeyczar=keyczar.keyczar.GenericKeyczar-class.html"><a title="keyczar.keyczar.GenericKeyczar" class="py-name" href="#" onclick="return doclink('link-171', 'GenericKeyczar', 'link-171');">GenericKeyczar</a></tt><tt class="py-op">(</tt><tt class="py-name">reader</tt><tt class="py-op">)</tt> </tt>
</div><a name="L234"></a><tt class="py-lineno">234</tt>  <tt class="py-line"> </tt>
<a name="UpdateGenericKeyczar"></a><div id="UpdateGenericKeyczar-def"><a name="L235"></a><tt class="py-lineno">235</tt> <a class="py-toggle" href="#" id="UpdateGenericKeyczar-toggle" onclick="return toggle('UpdateGenericKeyczar');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#UpdateGenericKeyczar">UpdateGenericKeyczar</a><tt class="py-op">(</tt><tt class="py-param">czar</tt><tt class="py-op">,</tt> <tt class="py-param">loc</tt><tt class="py-op">,</tt> <tt class="py-param">encrypter</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="UpdateGenericKeyczar-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="UpdateGenericKeyczar-expanded"><a name="L236"></a><tt class="py-lineno">236</tt>  <tt class="py-line">  <tt class="py-name">czar</tt><tt class="py-op">.</tt><tt id="link-172" class="py-name" targets="Method keyczar.keyczar.GenericKeyczar.Write()=keyczar.keyczar.GenericKeyczar-class.html#Write"><a title="keyczar.keyczar.GenericKeyczar.Write" class="py-name" href="#" onclick="return doclink('link-172', 'Write', 'link-172');">Write</a></tt><tt class="py-op">(</tt><tt class="py-name">loc</tt><tt class="py-op">,</tt> <tt class="py-name">encrypter</tt><tt class="py-op">)</tt> </tt>
</div><a name="L237"></a><tt class="py-lineno">237</tt>  <tt class="py-line"> </tt>
<a name="main"></a><div id="main-def"><a name="L238"></a><tt class="py-lineno">238</tt> <a class="py-toggle" href="#" id="main-toggle" onclick="return toggle('main');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="keyczar.keyczart-module.html#main">main</a><tt class="py-op">(</tt><tt class="py-param">argv</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="main-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="main-expanded"><a name="L239"></a><tt class="py-lineno">239</tt>  <tt class="py-line">  <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">argv</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L240"></a><tt class="py-lineno">240</tt>  <tt class="py-line">    <tt id="link-173" class="py-name" targets="Function keyczar.keyczart.Usage()=keyczar.keyczart-module.html#Usage"><a title="keyczar.keyczart.Usage" class="py-name" href="#" onclick="return doclink('link-173', 'Usage', 'link-173');">Usage</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L241"></a><tt class="py-lineno">241</tt>  <tt class="py-line">  <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L242"></a><tt class="py-lineno">242</tt>  <tt class="py-line">    <tt class="py-name">cmd</tt> <tt class="py-op">=</tt> <tt id="link-174" class="py-name" targets="Function keyczar.keyczart.GetCommand()=keyczar.keyczart-module.html#GetCommand"><a title="keyczar.keyczart.GetCommand" class="py-name" href="#" onclick="return doclink('link-174', 'GetCommand', 'link-174');">GetCommand</a></tt><tt class="py-op">(</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L243"></a><tt class="py-lineno">243</tt>  <tt class="py-line">    <tt id="link-175" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-175', 'flags', 'link-62');">flags</a></tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L244"></a><tt class="py-lineno">244</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">arg</tt> <tt class="py-keyword">in</tt> <tt class="py-name">argv</tt><tt class="py-op">:</tt> </tt>
<a name="L245"></a><tt class="py-lineno">245</tt>  <tt class="py-line">      <tt class="py-keyword">if</tt> <tt class="py-name">arg</tt><tt class="py-op">.</tt><tt class="py-name">startswith</tt><tt class="py-op">(</tt><tt class="py-string">"--"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L246"></a><tt class="py-lineno">246</tt>  <tt class="py-line">        <tt class="py-name">arg</tt> <tt class="py-op">=</tt> <tt class="py-name">arg</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">]</tt>  <tt class="py-comment"># trim leading dashes</tt> </tt>
<a name="L247"></a><tt class="py-lineno">247</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L248"></a><tt class="py-lineno">248</tt>  <tt class="py-line">          <tt class="py-op">[</tt><tt class="py-name">flag</tt><tt class="py-op">,</tt> <tt class="py-name">val</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">arg</tt><tt class="py-op">.</tt><tt class="py-name">split</tt><tt class="py-op">(</tt><tt class="py-string">"="</tt><tt class="py-op">)</tt> </tt>
<a name="L249"></a><tt class="py-lineno">249</tt>  <tt class="py-line">          <tt id="link-176" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-176', 'flags', 'link-62');">flags</a></tt><tt class="py-op">[</tt><tt id="link-177" class="py-name" targets="Function keyczar.keyczart.GetFlag()=keyczar.keyczart-module.html#GetFlag"><a title="keyczar.keyczart.GetFlag" class="py-name" href="#" onclick="return doclink('link-177', 'GetFlag', 'link-177');">GetFlag</a></tt><tt class="py-op">(</tt><tt class="py-name">flag</tt><tt class="py-op">)</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">val</tt> </tt>
<a name="L250"></a><tt class="py-lineno">250</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">ValueError</tt><tt class="py-op">:</tt> </tt>
<a name="L251"></a><tt class="py-lineno">251</tt>  <tt class="py-line">          <tt id="link-178" class="py-name"><a title="keyczar.keyczart.Usage" class="py-name" href="#" onclick="return doclink('link-178', 'Usage', 'link-173');">Usage</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L252"></a><tt class="py-lineno">252</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">cmd</tt> <tt class="py-op">==</tt> <tt id="link-179" class="py-name"><a title="keyczar.keyczart.CREATE" class="py-name" href="#" onclick="return doclink('link-179', 'CREATE', 'link-19');">CREATE</a></tt><tt class="py-op">:</tt> </tt>
<a name="L253"></a><tt class="py-lineno">253</tt>  <tt class="py-line">      <tt class="py-name">purpose</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-string">'crypt'</tt><tt class="py-op">:</tt> <tt id="link-180" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-180', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-181" class="py-name"><a title="keyczar.keyinfo.DECRYPT_AND_ENCRYPT" class="py-name" href="#" onclick="return doclink('link-181', 'DECRYPT_AND_ENCRYPT', 'link-8');">DECRYPT_AND_ENCRYPT</a></tt><tt class="py-op">,</tt> </tt>
<a name="L254"></a><tt class="py-lineno">254</tt>  <tt class="py-line">                 <tt class="py-string">'sign'</tt><tt class="py-op">:</tt> <tt id="link-182" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-182', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-183" class="py-name"><a title="keyczar.keyinfo.SIGN_AND_VERIFY" class="py-name" href="#" onclick="return doclink('link-183', 'SIGN_AND_VERIFY', 'link-12');">SIGN_AND_VERIFY</a></tt><tt class="py-op">}</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-184" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-184', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-185" class="py-name"><a title="keyczar.keyczart.PURPOSE" class="py-name" href="#" onclick="return doclink('link-185', 'PURPOSE', 'link-52');">PURPOSE</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L255"></a><tt class="py-lineno">255</tt>  <tt class="py-line">      <tt id="link-186" class="py-name"><a title="keyczar.keyczart.Create" class="py-name" href="#" onclick="return doclink('link-186', 'Create', 'link-138');">Create</a></tt><tt class="py-op">(</tt><tt id="link-187" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-187', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-188" class="py-name"><a title="keyczar.keyczart.LOCATION" class="py-name" href="#" onclick="return doclink('link-188', 'LOCATION', 'link-44');">LOCATION</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-189" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-189', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-190" class="py-name"><a title="keyczar.keyczart.NAME" class="py-name" href="#" onclick="return doclink('link-190', 'NAME', 'link-46');">NAME</a></tt><tt class="py-op">,</tt> <tt class="py-string">'Test'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">purpose</tt><tt class="py-op">,</tt>  </tt>
<a name="L256"></a><tt class="py-lineno">256</tt>  <tt class="py-line">             <tt id="link-191" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-191', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-192" class="py-name"><a title="keyczar.keyczart.ASYMMETRIC" class="py-name" href="#" onclick="return doclink('link-192', 'ASYMMETRIC', 'link-58');">ASYMMETRIC</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L257"></a><tt class="py-lineno">257</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">cmd</tt> <tt class="py-op">==</tt> <tt id="link-193" class="py-name"><a title="keyczar.keyczart.ADDKEY" class="py-name" href="#" onclick="return doclink('link-193', 'ADDKEY', 'link-21');">ADDKEY</a></tt><tt class="py-op">:</tt> </tt>
<a name="L258"></a><tt class="py-lineno">258</tt>  <tt class="py-line">      <tt class="py-keyword">if</tt> <tt id="link-194" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-194', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt id="link-195" class="py-name"><a title="keyczar.keyczart.CRYPTER" class="py-name" href="#" onclick="return doclink('link-195', 'CRYPTER', 'link-60');">CRYPTER</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L259"></a><tt class="py-lineno">259</tt>  <tt class="py-line">        <tt class="py-name">crypter</tt> <tt class="py-op">=</tt> <tt id="link-196" class="py-name"><a title="keyczar
keyczar.keyczar" class="py-name" href="#" onclick="return doclink('link-196', 'keyczar', 'link-1');">keyczar</a></tt><tt class="py-op">.</tt><tt id="link-197" class="py-name" targets="Class keyczar.keyczar.Encrypter=keyczar.keyczar.Encrypter-class.html"><a title="keyczar.keyczar.Encrypter" class="py-name" href="#" onclick="return doclink('link-197', 'Encrypter', 'link-197');">Encrypter</a></tt><tt class="py-op">.</tt><tt id="link-198" class="py-name"><a title="keyczar.keyczar.Crypter.Read
keyczar.keyczar.Encrypter.Read
keyczar.keyczar.GenericKeyczar.Read
keyczar.keyczar.Keyczar.Read
keyczar.keyczar.Signer.Read
keyczar.keyczar.Verifier.Read
keyczar.keydata.KeyMetadata.Read
keyczar.keydata.KeyVersion.Read
keyczar.keys.AesKey.Read
keyczar.keys.DsaPrivateKey.Read
keyczar.keys.DsaPublicKey.Read
keyczar.keys.HmacKey.Read
keyczar.keys.RsaPrivateKey.Read
keyczar.keys.RsaPublicKey.Read" class="py-name" href="#" onclick="return doclink('link-198', 'Read', 'link-136');">Read</a></tt><tt class="py-op">(</tt><tt id="link-199" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-199', 'flags', 'link-62');">flags</a></tt><tt class="py-op">[</tt><tt id="link-200" class="py-name"><a title="keyczar.keyczart.CRYPTER" class="py-name" href="#" onclick="return doclink('link-200', 'CRYPTER', 'link-60');">CRYPTER</a></tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L260"></a><tt class="py-lineno">260</tt>  <tt class="py-line">      <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L261"></a><tt class="py-lineno">261</tt>  <tt class="py-line">        <tt class="py-name">crypter</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L262"></a><tt class="py-lineno">262</tt>  <tt class="py-line">      <tt id="link-201" class="py-name"><a title="keyczar.keyczart.AddKey" class="py-name" href="#" onclick="return doclink('link-201', 'AddKey', 'link-139');">AddKey</a></tt><tt class="py-op">(</tt><tt id="link-202" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-202', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-203" class="py-name"><a title="keyczar.keyczart.LOCATION" class="py-name" href="#" onclick="return doclink('link-203', 'LOCATION', 'link-44');">LOCATION</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt>  </tt>
<a name="L263"></a><tt class="py-lineno">263</tt>  <tt class="py-line">             <tt id="link-204" class="py-name"><a title="keyczar.keyinfo" class="py-name" href="#" onclick="return doclink('link-204', 'keyinfo', 'link-3');">keyinfo</a></tt><tt class="py-op">.</tt><tt id="link-205" class="py-name" targets="Function keyczar.keyinfo.GetStatus()=keyczar.keyinfo-module.html#GetStatus"><a title="keyczar.keyinfo.GetStatus" class="py-name" href="#" onclick="return doclink('link-205', 'GetStatus', 'link-205');">GetStatus</a></tt><tt class="py-op">(</tt><tt id="link-206" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-206', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-207" class="py-name"><a title="keyczar.keyczart.STATUS" class="py-name" href="#" onclick="return doclink('link-207', 'STATUS', 'link-50');">STATUS</a></tt><tt class="py-op">,</tt> <tt class="py-string">'ACTIVE'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt>  </tt>
<a name="L264"></a><tt class="py-lineno">264</tt>  <tt class="py-line">             <tt class="py-name">int</tt><tt class="py-op">(</tt><tt id="link-208" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-208', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-209" class="py-name"><a title="keyczar.keyczart.SIZE" class="py-name" href="#" onclick="return doclink('link-209', 'SIZE', 'link-48');">SIZE</a></tt><tt class="py-op">,</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">crypter</tt><tt class="py-op">)</tt> </tt>
<a name="L265"></a><tt class="py-lineno">265</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">cmd</tt> <tt class="py-op">==</tt> <tt id="link-210" class="py-name"><a title="keyczar.keyczart.PUBKEY" class="py-name" href="#" onclick="return doclink('link-210', 'PUBKEY', 'link-23');">PUBKEY</a></tt><tt class="py-op">:</tt> </tt>
<a name="L266"></a><tt class="py-lineno">266</tt>  <tt class="py-line">      <tt id="link-211" class="py-name"><a title="keyczar.keyczart.PubKey" class="py-name" href="#" onclick="return doclink('link-211', 'PubKey', 'link-147');">PubKey</a></tt><tt class="py-op">(</tt><tt id="link-212" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-212', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-213" class="py-name"><a title="keyczar.keyczart.LOCATION" class="py-name" href="#" onclick="return doclink('link-213', 'LOCATION', 'link-44');">LOCATION</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-214" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-214', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-215" class="py-name"><a title="keyczar.keyczart.DESTINATION" class="py-name" href="#" onclick="return doclink('link-215', 'DESTINATION', 'link-54');">DESTINATION</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L267"></a><tt class="py-lineno">267</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">cmd</tt> <tt class="py-op">==</tt> <tt id="link-216" class="py-name"><a title="keyczar.keyczart.PROMOTE" class="py-name" href="#" onclick="return doclink('link-216', 'PROMOTE', 'link-25');">PROMOTE</a></tt><tt class="py-op">:</tt> </tt>
<a name="L268"></a><tt class="py-lineno">268</tt>  <tt class="py-line">      <tt id="link-217" class="py-name"><a title="keyczar.keyczar.GenericKeyczar.Promote
keyczar.keyczart.Promote" class="py-name" href="#" onclick="return doclink('link-217', 'Promote', 'link-121');">Promote</a></tt><tt class="py-op">(</tt><tt id="link-218" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-218', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-219" class="py-name"><a title="keyczar.keyczart.LOCATION" class="py-name" href="#" onclick="return doclink('link-219', 'LOCATION', 'link-44');">LOCATION</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt id="link-220" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-220', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-221" class="py-name"><a title="keyczar.keyczar.VERSION
keyczar.keyczart.VERSION" class="py-name" href="#" onclick="return doclink('link-221', 'VERSION', 'link-56');">VERSION</a></tt><tt class="py-op">,</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L269"></a><tt class="py-lineno">269</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">cmd</tt> <tt class="py-op">==</tt> <tt id="link-222" class="py-name"><a title="keyczar.keyczart.DEMOTE" class="py-name" href="#" onclick="return doclink('link-222', 'DEMOTE', 'link-27');">DEMOTE</a></tt><tt class="py-op">:</tt> </tt>
<a name="L270"></a><tt class="py-lineno">270</tt>  <tt class="py-line">      <tt id="link-223" class="py-name"><a title="keyczar.keyczar.GenericKeyczar.Demote
keyczar.keyczart.Demote" class="py-name" href="#" onclick="return doclink('link-223', 'Demote', 'link-126');">Demote</a></tt><tt class="py-op">(</tt><tt id="link-224" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-224', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-225" class="py-name"><a title="keyczar.keyczart.LOCATION" class="py-name" href="#" onclick="return doclink('link-225', 'LOCATION', 'link-44');">LOCATION</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt id="link-226" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-226', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-227" class="py-name"><a title="keyczar.keyczar.VERSION
keyczar.keyczart.VERSION" class="py-name" href="#" onclick="return doclink('link-227', 'VERSION', 'link-56');">VERSION</a></tt><tt class="py-op">,</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L271"></a><tt class="py-lineno">271</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">cmd</tt> <tt class="py-op">==</tt> <tt id="link-228" class="py-name"><a title="keyczar.keyczart.REVOKE" class="py-name" href="#" onclick="return doclink('link-228', 'REVOKE', 'link-29');">REVOKE</a></tt><tt class="py-op">:</tt> </tt>
<a name="L272"></a><tt class="py-lineno">272</tt>  <tt class="py-line">      <tt id="link-229" class="py-name"><a title="keyczar.keyczar.GenericKeyczar.Revoke
keyczar.keyczart.Revoke" class="py-name" href="#" onclick="return doclink('link-229', 'Revoke', 'link-131');">Revoke</a></tt><tt class="py-op">(</tt><tt id="link-230" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-230', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-231" class="py-name"><a title="keyczar.keyczart.LOCATION" class="py-name" href="#" onclick="return doclink('link-231', 'LOCATION', 'link-44');">LOCATION</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt id="link-232" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-232', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-233" class="py-name"><a title="keyczar.keyczar.VERSION
keyczar.keyczart.VERSION" class="py-name" href="#" onclick="return doclink('link-233', 'VERSION', 'link-56');">VERSION</a></tt><tt class="py-op">,</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L273"></a><tt class="py-lineno">273</tt>  <tt class="py-line">    <tt class="py-keyword">elif</tt> <tt class="py-name">cmd</tt> <tt class="py-op">==</tt> <tt id="link-234" class="py-name"><a title="keyczar.keyczart.GENKEY" class="py-name" href="#" onclick="return doclink('link-234', 'GENKEY', 'link-31');">GENKEY</a></tt><tt class="py-op">:</tt> </tt>
<a name="L274"></a><tt class="py-lineno">274</tt>  <tt class="py-line">      <tt id="link-235" class="py-name" targets="Function keyczar.keyczart.GenKeySet()=keyczar.keyczart-module.html#GenKeySet"><a title="keyczar.keyczart.GenKeySet" class="py-name" href="#" onclick="return doclink('link-235', 'GenKeySet', 'link-235');">GenKeySet</a></tt><tt class="py-op">(</tt><tt id="link-236" class="py-name"><a title="keyczar.keyczart.flags" class="py-name" href="#" onclick="return doclink('link-236', 'flags', 'link-62');">flags</a></tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt id="link-237" class="py-name"><a title="keyczar.keyczart.LOCATION" class="py-name" href="#" onclick="return doclink('link-237', 'LOCATION', 'link-44');">LOCATION</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L275"></a><tt class="py-lineno">275</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L276"></a><tt class="py-lineno">276</tt>  <tt class="py-line">      <tt id="link-238" class="py-name"><a title="keyczar.keyczart.Usage" class="py-name" href="#" onclick="return doclink('link-238', 'Usage', 'link-173');">Usage</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L277"></a><tt class="py-lineno">277</tt>  <tt class="py-line"> </tt>
<a name="L278"></a><tt class="py-lineno">278</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
<a name="L279"></a><tt class="py-lineno">279</tt>  <tt class="py-line">  <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">exit</tt><tt class="py-op">(</tt><tt id="link-239" class="py-name" targets="Function keyczar.keyczart.main()=keyczar.keyczart-module.html#main"><a title="keyczar.keyczart.main" class="py-name" href="#" onclick="return doclink('link-239', 'main', 'link-239');">main</a></tt><tt class="py-op">(</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">)</tt>  <tt class="py-comment"># sys.argv[0] is name of program</tt> </tt>
<a name="L280"></a><tt class="py-lineno">280</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="keyczar-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >Keyczar</th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sun Aug 10 17:05:05 2008
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
